﻿<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/head.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<style>
*{margin:0px;padding:0px;}
body{font-size:12px;}
</style>
<script>
  $(document).ready(function() {
		_over_menu = null; //鼠标经过的一级菜单
		_submenu = null;//鼠标经过的一级菜单对应的二级菜单
		_clicked_menu = null; //被点击的一级菜单
		_clicked_submenu = null;//被点击的二级菜单
		
		$(".head_menu .center").each(function() {
			_over_menu = $(".head_menu_down");
			$(this).mouseover(function() {//鼠标经过事件
				showMenu(this);
			}).mouseout(function() {//鼠标移出事件
				restore();
			}).click(function() {//鼠标点击事件
				_clicked_menu = this;
				resetClickedSubmenu();
			});
		});
		
		_clicked_submenu = $(".headtreemenu_down");
		$(".headtreemenu a").each(function() {
			$(this).mousedown(function() {//二级菜单的点击事件
				resetClickedSubmenu();
				_clicked_submenu = $(this.parentElement).addClass("headtreemenu_down");
				
				var pdiv = $(this).parents("div")[0];
				if ($(pdiv).attr("id")){
					//alert(pdiv.id);
					_clicked_menu = $("#parent_"+pdiv.id).get(0);
				}
			});
		});
		
		//当主菜单被点击时，重设被点击的二级菜单
		function resetClickedSubmenu() {
			_clicked_submenu = $(".headtreemenu_down");
			if (_clicked_submenu) {
				_clicked_submenu.removeClass("headtreemenu_down").addClass("headtreemenu");
			}
		}
		
		//还原被点击菜单的状态
		function restore() {
			if (_clicked_menu) {
				showMenu(_clicked_menu);
			}
		}
		
		//高亮菜单并显示对应的子菜单
		function showMenu(obj) {
			if (_over_menu) {
					_over_menu.removeClass("head_menu_down").addClass("center");
					if (_submenu) {
						_submenu.css("display", "none");
					}
				}
				_over_menu = $(obj);
				_over_menu.removeClass("center").addClass("head_menu_down");
				
				var submenuId = $(obj).attr("id").substring($(obj).attr("id").indexOf('_')+1);
				submenuId = "#"+submenuId;
				//alert(submenuId);
				_submenu = $(submenuId);
				_submenu.css("display", "");
		}
		
		//取消焦点
		$("a").each(function() {
			$(this).click(function() {return true;}).focus(function(){this.blur();});
		});

		$("#fullSrc").toggle(function(){
			$("#fullSrc").text("还原");
			$("#banner").hide();
			$(window.parent.document).find("#frameset1").attr("rows","29,*");
		},function(){
			$("#fullSrc").text("全屏");
			$("#banner").show();
			$(window.parent.document).find("#frameset1").attr("rows","128,*");
		});
		
  });

  function logout(){
		if(confirm("确定注销?")){
			parent.location.href = "j_spring_security_logout";
		}
	}
	function returnMainPage(){//回到主页
		parent.location.href = "${ctx}/" + "index.do";
	}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border-bottom:1px solid #EAEAEA; background:url(images/title.jpg) no-repeat">
	<tr id="banner">
		<td height="70" align="right" valign="bottom" colspan="2">
		<table width="500" border="0" cellpadding="0" cellspacing="3">
		  <tr>
		    <td width="200" id="show_time" align="left" nowrap="nowrap"></td>
		    <td width="300" valign="top" align="left" nowrap="nowrap"><b>登录用户：</b>${user.userName}</td>
	      </tr>
	    </table>
	    </td>
	</tr>
	<tr>
		<td colspan="2">
			<table width="100%" border="0" cellpadding="0" cellspacing="0" class="xmfont">${menu }</table>
		</td>
	</tr>
</table>
</body>
</html>
